<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>景区管理</title>
    <link rel="stylesheet" href="//unpkg.com/layui@2.6.8/dist/css/layui.css">
    <script src="https://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script src="//unpkg.com/layui@2.6.8/dist/layui.js"></script>
    <link th:href="@{/admin/admin.css}" rel="stylesheet">
</head>
<body>
<!--导入左侧和头部-->
<!--<div id="Master" th:include="admin/adminView"></div>-->
<div class="adminView">
    <div>
        <ul class="layui-nav" lay-filter="" style="position: fixed;z-index: 999;width: 100%;border-radius: 0;top: 0">
            <li class="layui-nav-item"><h1 style="font-size: 20px">leileiMann旅游小助手 后台管理系统</h1></li>
            <li class="layui-nav-item" style="margin-right: 100px;float: right">
                <a href="#;"><p th:text="${session.admin.getAdminname()}" style="color: #00F7DE"></p></a>
                <dl class="layui-nav-child"> <!-- 二级菜单 -->
                    <dd><a href="">个人中心</a></dd>
                    <dd><a href="">退出</a></dd>
                </dl>
            </li>
        </ul>
    </div>
    <div class="chuizhicebian" style="float: left">
        <ul class="layui-nav layui-nav-tree layui-nav-side" lay-filter="test" style="background-color: #538eff;border-radius: 0;position: fixed;margin-top: 60px">
            <li class="layui-nav-item">
                <a>城市管理</a>
                <dl class="layui-nav-child">
                    <dd><a href="#">城市管理</a></dd>
                    <dd><a href="#">新增城市</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item layui-nav-itemed">
                <a>景区管理</a>
                <dl class="layui-nav-child">
                    <dd><a href="/index/SSpotManger">景区管理</a></dd>
                    <dd><a href="#">新增景区</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item">
                <a>酒店管理</a>
                <dl class="layui-nav-child">
                    <dd><a href="#">酒店管理</a></dd>
                    <dd><a href="#">新增酒店</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item">
                <a>餐厅管理</a>
                <dl class="layui-nav-child">
                    <dd><a href="#">餐厅管理</a></dd>
                    <dd><a href="#">新增餐厅</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="#">用户管理</a></li>
        </ul>
    </div>
</div>


<div id="container-SSpotManger" style="margin-left: 200px;margin-top: 60px; height: 300px">
    <div id="seachSSpot" style="margin-left: 100px;margin-top: 100px">
        <p style="font-size: 20px">景区名:</p>
        <input id="sspotsea" type="text" name="title" placeholder="请输入搜索的景区名称"
               autocomplete="off" class="layui-input" style="width: 200px;position: absolute;margin-left: 70px;margin-top: -30px">
        <button type="button" class="layui-btn layui-btn-normal" style="margin-left: 280px;margin-top: -40px"><i class="layui-icon layui-icon-search"></i></button>
    </div>
    <div id="searchCity" style="margin-left: 600px;margin-top: -40px;position: absolute">
        <p style="font-size: 20px">城市名:</p>
        <input id="citysea" type="text" name="title" placeholder="请输入城市名"
               autocomplete="off" class="layui-input" style="width: 200px;position: absolute;margin-left: 70px;margin-top: -30px">
        <button type="button" class="layui-btn layui-btn-normal" style="margin-left: 280px;margin-top: -40px"><i class="layui-icon layui-icon-search"></i></button>
    </div>
    <hr class="layui-border-green">

    <table class="layui-table" lay-skin="row" style="margin-left: auto;margin-right: auto;overflow: auto">
        <thead>
            <tr>
                <th style="text-align: center;width: 84px"><input type="checkbox" onclick="allSel()" id="selectALl">全/反选</th>
                <th style="text-align: center;width: 248px">景区名称</th>
                <th style="text-align: center;width: 103px">归属城市</th>
                <th style="text-align: center;width: 103px">价格</th>
                <th style="text-align: center;width: 103px">等级</th>
                <th style="text-align: center;width: 510px">地址</th>
                <th style="text-align: center;width: 130px">操作</th>
            </tr>
        </thead>
        <tbody>
            <span th:each="sspot:${adsSpotList}">
                <tr>
                    <td style="text-align: center;width: 84px"><input type="checkbox" name="select"></td>
                    <td style="text-align: center;width: 248px" th:text="${sspot.getSspotname()}"></td>
                    <td style="text-align: center;width: 103px" th:text="${sspot.getCityname()}"></td>
                    <td style="text-align: center;width: 103px" th:text="${sspot.getPrice()}"></td>
                    <td style="text-align: center;width: 103px" th:text="${sspot.getAnum()}"></td>
                    <td style="text-align: center;width: 510px" th:text="${sspot.getAddress()}"></td>
                    <td style="text-align: center;width: 130px">
                        <div class="layui-btn-group">
                          <button type="button" class="layui-btn layui-btn-primary layui-btn-sm">
                            <i class="layui-icon">&#xe642;</i>  <!--修改按钮-->
                          </button>
                          <button type="button" class="layui-btn layui-btn-primary layui-btn-sm">
                            <i class="layui-icon">&#xe640;</i>  <!--删除按钮-->
                          </button>
                        </div>
                    </td>
                </tr>
            </span>
        </tbody>
    </table>
    <div style="margin-right: 130px;float: right;margin-bottom: 20px">
        <a class="pre" th:href="@{/index/SSpotManger(pageNum=${adPageNum}-1)}" th:if="${adPageNum>1}">
            <button type="button" class="layui-btn layui-btn-sm layui-btn-normal">
                <i class="layui-icon layui-icon-left"></i>
            </button>
        </a>
        <a class="next" th:href="@{/index/SSpotManger(pageNum=${adPageNum}+1)}" th:if="${adPageNum<=count}">
            <button type="button" class="layui-btn layui-btn-sm layui-btn-normal" style="margin-right: 30px">
                <i class="layui-icon layui-icon-right"></i>
            </button>
        </a>
        当前为第<input id="pageNum" type="number" th:value="${adPageNum}" style="width: 30px">页
    </div>
</div>



<script>
    $('#subPageNum').onclick = function (){
        $.ajax({
            url:"/index/SSpotManger",
            data:{'pageNum':$('#pageNum').val()},   //传递的参数为页面跳转数输入框的值
            type: 'POST',
            dataType: 'json'
        })
    }
   function allSel(){
       var sel = document.getElementsByName('select');
       sel.forEach(a =>{
           if (!a.checked){
               a.checked = true
           }else {
               a.checked = false
           }
       })
   }


    // function changePageNum(){
    //     $.ajax({
    //         url:"/index/SSpotManger",
    //         data:{'pageNum':$('#pageNum').val()},   //传递的参数为页面跳转数输入框的值
    //         type: 'GET',
    //         dataType: 'json'
    //     })
    // }
    // layui.use("form",function () {
    //     var form = layui.form;
    //     var $ = layui.$;
    //     //监听提交
    //     form.on("submit(login)",function (data) {
    //         $.ajax({
    //             url:"/user/toLogin",
    //             type:"POST",
    //             data:data.field,
    //             dataType:"json",
    //             success: function (result) {
    //                 if(result.code == "1"){
    //                     layer.msg(result.msg,{icon:result.icon,anim:result.anim},function () {
    //                         location.href = '/index/view';    //登录成功，转向带用户名的主页
    //                     });
    //                 }else{
    //                     layer.msg(result.msg,{icon:result.icon,anim:result.anim});
    //                 }
    //             }
    //         });
    //         return false;
    //     });
    // });

</script>

</body>
</html>